<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>遍历FileList对象</title>
<script type="text/javascript">
function ShowFiles(){
	var fileList=document.getElementById("files").files;   /* 获取FileList对象 */
	var msg=document.getElementById("msg");
	var file;
	for(var i=0;i<fileList.length;i++){
		file=fileList[i];                 /* 获取单个File对象 */
		msg.innerHTML+=file.name+";<br />";
	}
}
</script>
</head>
<body>
<form action="" method="post">
  <input type="file" id="files" multiple />  <!-- 可选择多个文件 -->
  <input type="button" value="显示文件" onclick="ShowFiles()" />
  <p id="msg"></p>
</form>
</body>
</html>